package com.taotao.controller;

import com.taotao.service.ItemCategoryParamService;
import com.taotao.util.TaotaoResult;
import com.taotao.util.model.EasyUIResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * describe:商品类别参数
 * @author hong.zheng
 * @date 2018/08/27
 */
@Controller
@RequestMapping("/item/categoryparam")
public class ItemCategoryParamController {
    @Autowired
    private ItemCategoryParamService itemCategoryParamService;
    @RequestMapping("/list")
    @ResponseBody
    public EasyUIResult getItemParamList(@RequestParam(defaultValue = "1") Integer page,
                                         @RequestParam(defaultValue = "30") Integer rows)   {
        EasyUIResult easyUIResult = itemCategoryParamService.getItemCategoryParamList(page,rows);
        return easyUIResult;
    }
    @RequestMapping("query/itemcatid/{categoryId}")
    @ResponseBody
    public TaotaoResult queryCatalogById(@PathVariable long categoryId) throws Exception {
        //根据分类id查询列表
        TaotaoResult result = itemCategoryParamService.queryItemCategoryParamById(categoryId);
        return result;
    }
    @RequestMapping("save")
    @ResponseBody
    public TaotaoResult saveItemCategoryParam(long categoryId, String paramData) throws Exception {
        //根据分类id查询列表
        TaotaoResult result = itemCategoryParamService.saveItemCategoryParam(categoryId,paramData);
        return result;
    }
}
